﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TicketMovie.User
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        private DataClasses1DataContext dc = new DataClasses1DataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.table_price();
                this.table_price1();
            }
        }
        private void table_price()
        {
            List<Film> f = this.dc.Films.Where(kq => kq.film_format.Equals("2D")).Distinct().ToList();
            
            List<Type_room> tr = this.dc.Type_rooms.ToList();
            List<Type_chair> tc = this.dc.Type_chairs.ToList();

            List<Doawlist> giaroom = new List<Doawlist>();

            for (int i = 0; i < tr.Count; i++)
            {
                giaroom.Add(new Doawlist(Convert.ToDouble(tr[i].add_price.Value)));
            }
            List<Doawlist> bang = new List<Doawlist>();
            for (int i = 0; i < tc.Count;i++ )
            {
                bang.Add(new Doawlist(tc[i].name_chair.ToString(), Convert.ToDouble(tc[i].add_price), Convert.ToDouble(f[0].price), giaroom[0].Giaroom, giaroom[1].Giaroom, giaroom[2].Giaroom));
            }
            this.Repeater1.DataSource = bang;
            this.DataBind();
            

        }
        private void table_price1()
        {
            List<Film> f = this.dc.Films.Where(kq => kq.film_format.Equals("3D")).Distinct().ToList();

            List<Type_room> tr = this.dc.Type_rooms.ToList();
            List<Type_chair> tc = this.dc.Type_chairs.ToList();

            List<Doawlist> giaroom = new List<Doawlist>();

            for (int i = 0; i < tr.Count; i++)
            {
                giaroom.Add(new Doawlist(Convert.ToDouble(tr[i].add_price.Value)));
            }
            List<Doawlist> bang = new List<Doawlist>();
            for (int i = 0; i < tc.Count; i++)
            {
                bang.Add(new Doawlist(tc[i].name_chair.ToString(), Convert.ToDouble(tc[i].add_price), Convert.ToDouble(f[0].price), giaroom[0].Giaroom, giaroom[1].Giaroom, giaroom[2].Giaroom));
            }
            this.Repeater2.DataSource = bang;
            this.DataBind();


        }

    
    }
}